<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>客户管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="${ctxPath}/assets/common/libs/layui/css/layui.css?v=${constants.getReleaseVersion()}"/>
    <link rel="stylesheet" href="${ctxPath}/assets/common/module/admin.css?v=${constants.getReleaseVersion()}" media="all"/>
    <link rel="stylesheet" href="${ctxPath}/assets/expand/css/style.css?v=${constants.getReleaseVersion()}" media="all"/>
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
<div class="layui-body-header">
    <span class="layui-body-header-title">客户管理</span>
</div>
<input type="hidden" id="channelCode" name="channelCode" value="${channelCode}">
<input type="hidden" id="index" name="index" >
<div class="layui-form toolbar">
    <div class="layui-form-item">
        <div class="layui-inline">
            <input id="customerName" name="customerName" class="layui-input" type="text" placeholder="用户名称"/>
        </div>
        <div class="layui-inline">
            <button id="btnSearch" class="layui-btn icon-btn"><i class="layui-icon">&#xe615;</i>搜索
            </button>
        </div>
    </div>
</div>
  <table class="layui-table" id="InsCustomerTable" lay-filter="InsCustomerTable"></table>
<script type="text/javascript">
    var Feng = {
        ctxPath: "${ctxPath}",
        version: '${constants.getReleaseVersion()}'
    };
</script>
<script type="text/javascript" src="${ctxPath}/assets/common/libs/layui/layui.js?v=${constants.getReleaseVersion()}"></script>
<script type="text/javascript" src="${ctxPath}/assets/common/js/common.js?v=${constants.getReleaseVersion()}"></script>
<script>
    var table;

    function getDate(){
        var checkStatus = table.checkStatus('InsCustomerTable'); //idTest 即为基础参数 id 对应的值

        return checkStatus.data;
    }

    layui.use(['layer', 'form', 'table', 'admin', 'ax'], function () {
        var $ = layui.$;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var $ax = layui.ax;
        var admin = layui.admin;

        // 让当前iframe弹层高度适应
        //admin.iframeAuto();

        /**
         * 客户管理管理初始化
         */
        var InsCustomer = {
            tableId: "InsCustomerTable",	//表格id
            condition: {}
        };

        /**
         * 初始化表格的列
         */
        InsCustomer.initColumn = function () {
            return [[
                {type:'radio'},
                {title: '渠道名称', field: 'channelName', visible: true, align: 'center', valign: 'middle'},
                {title: '用户名称', field: 'customerName', visible: true, align: 'center', valign: 'middle'},
                {title: '证件类型', field: 'cardType',visible: true, align: 'center',valign: 'middle',templet: function (data) {
                        if (data.cardType == "1") {
                            return '营业执照';
                        } else if (data.cardType == "2") {
                            return '身份证';
                        }
                    }
                },
                {title: '证件号码', field: 'cardNo', visible: true, align: 'center', valign: 'middle'}
            ]];
        };

        var channelCode = $("#channelCode").val();

        /**
         * 查询中信分期列表
         */
        InsCustomer.search = function () {
            var queryData = {};
            queryData['channelCode'] = $("#channelCode").val();
            queryData['customerName'] = $("#customerName").val();
            table.reload(InsCustomer.tableId, {where: queryData, page: {curr: 1 }});
        };

        // 搜索按钮点击事件
        $('#btnSearch').click(function () {
            InsCustomer.search();
        });



        // 渲染表格
        var tableResult = table.render({
            elem: '#' + InsCustomer.tableId,
            url: Feng.ctxPath + '/insCustomer/list',
            page: true,
            height: 350,
            cellMinWidth: 100,
            cols: InsCustomer.initColumn(),
            where:{channelCode: channelCode}
        });


    });


</script>
</body>
</html>